#include <stdio.h>

#define STDIN
//#define DEBUG

#define MAXN 1001
int dp[MAXN];
int v[MAXN];
int N;

#define max(a, b) (a) > (b) ? (a) : (b)

int main()
{
#ifdef STDIN
    freopen("bin/2533.in", "r", stdin);
#endif

    scanf("%d", &N);
    int i, j;

    dp[0] = 1;
    for (i = 0; i < N; i++)
    {
        scanf("%d", v+i);
        for (j = 0, dp[i] = 1; j < i; j++)
            if (v[i] > v[j])
                dp[i] = max(dp[i], dp[j]+1);
    }
    int max_len = 0;
    for (i = 0; i < N; i++)
    {
        max_len = max(max_len, dp[i]);
    }
    printf("%d\n", max_len);

    return 0;
}
    
